
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="../../style/css/style.css" rel="stylesheet" type="text/css" />
    <script src="../../style/js/jquery-1.8.3.min.js"></script>
    <script src="../../style/js/ajaxfileupload.js" type="text/javascript"></script>
    <script type="text/javascript">

        //保存网站信息
        function subform() {
            var title = $("#title").val();
            var recordation = $("#recordation").val();
            var companyName = $("#companyName").val();
            var tel = $("#tel").val();
            $.ajaxFileUpload({
                    url: '../../web/save', //用于文件上传的服务器端请求地址  调用后端接口(interface)
                    fileElementId: 'logoImgSrc', //文件上传域的ID
                    dataType: 'json', //返回值类型 一般设置为json
                    data: {
                        title : title,
                        recordation : recordation,
                        companyName : companyName,
                        tel : tel
                    },
                    success: function (data) {
                        if (data.code == 200) {
                            imgSrc = data.data;
                            alert("添加成功");
                            location.replace("list.html");
                        }else{
                            alert("添加失败");
                        }
                    }
                }
            )
        }
    </script>
</head>

<body>
<form id="formId">
    <div class="formbody">
        <div class="formtitle"><span>基本信息</span></div>
        <ul class="forminfo">

            <li>
                <label>网站标题名</label>
                <input class="dfinput"  name="title" id="title" type="text"/>
            </li>
            <li>
                <label>logo图片链接</label>
                <input class="dfinput"  name="logoImgSrc" id="logoImgSrc" type="file" accept=".jpg,.png,.gif"/>
             <!--   <input type="file" name="logoImgSrc" accept=".jpg,.png,.gif" id="fileId">
                <input type="button" value="上传"  class="dfinput" onclick="fileUpload()">-->
            </li>
            <li>
                <label>网站备案号</label>
                <input class="dfinput"  name="recordation" id="recordation" type="text"/>
            </li>
            <li>
                <label>公司名称</label>
                <input class="dfinput"  name="companyName"  id="companyName" type="text"/>
            </li>
            <li>
                <label>联系方式</label>
                <input class="dfinput"  name="tel" id="tel" type="text"/>
            </li>
            <li>
                <input name="" type="button" class="btn" value="确认保存" onclick="subform()"/>
            </li>
        </ul>
    </div>
</form>
</body>

</html>
